package com.BlogPark.controller;

import com.BlogPark.pojo.Article;
import com.BlogPark.service.EditArticleService.EditArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: MFM
 * @Date: 2022/8/11 - 08 - 11 - 14:58
 * @version: 1.0
 * 编辑文章界面 支持 将文章上传服务器并审核  编辑文章  读取本地md文件 读取本地html文件 响应
 */

@RestController
@RequestMapping("/EditArticle")
public class EditArticleController {
    @Autowired
    private EditArticleService editArticleService;

    @PostMapping("/Examine")
    public void toExamine(@RequestBody Article article) throws Exception {
        editArticleService.publishArticle(article);
    }

    @GetMapping("/{articleId}")
    public Article readArticle(@PathVariable String articleId) throws Exception {
        return editArticleService.readArticle(articleId);
    }
}
